import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 8/25/13
 * Time: 3:11 PM
 * To change this template use File | Settings | File Templates.
 */
public class PlayerTest {
    private Player player;


    @Before
    public void setup() {
        player=new Player(1);
    }


    @Test
    public void shouldReturnFifteenAfterScoringOnce(){
        player.scorePoint();
        assertThat(player.getScore(), is(15));
    }

    @Test
       public void shouldReturnFifteenAfterScoringForASecondTime(){
        player.scorePoint();
        player.scorePoint();
        assertThat(player.getScore(), is(30));
    }

    @Test
    public void shouldReturnFifteenAfterScoringForAThirdTime(){
        player.scorePoint();
        player.scorePoint();
        player.scorePoint();
        assertThat(player.getScore(), is(40));
    }

    @Test
    public void shouldDeclarePlayerOneIsWinner() throws Exception {
       player.scorePoint();
       player.scorePoint();
       player.scorePoint();
       player.scorePoint();
       assertTrue(player.isWinner());
    }
}
